{% extends 'siteAdmin/index.html' %}
{% block operation %}
{% include 'siteAdmin/tinyPart.html' with context %}
{% if req.path ==pageData['subdomain']+'/siteAdmin/serviceAdd' %}
       <div id="box">
        {% if pageData['service'].id %}
            <form  method="POST" action="/siteAdmin/serviceAdd?update={{pageData['service'].id}}">
        {% else %}
            <form  method="POST" action="/siteAdmin/serviceAdd?add">
        {% endif %}

                <span class="word">Nome del servizio</span>
                <span class="insert">
                <input name="serviceTitle" type="text" value ="{{pageData['service'].denomination|nonone}}" style="width: 30%"/></span><br /><br />
                <span class="word">Codice servizio</span>
                <span class="insert">
                <input name="serviceCodice" type="text" value ="{{pageData['service'].codice|nonone}}" style="width: 20%"/></span><br /><br />
                <span class="word">Prezzo servizio</span>
                <span class="insert">
                <input name="servicePrezzo" type="text" value ="{{pageData['service'].prezzo|nonone}}" style="width: 10%"/></span><br /><br />
                <span class="word">Prezzo rinnovo servizio</span>
                <span class="insert">
                <input name="servicePrezzoRinnovo" type="text" value ="{{pageData['service'].prezzo_rinnovo|nonone}}" style="width: 10%"/></span><br /><br />
                <span class="word">Abstract</span><br />
                <textarea name="serviceAbstract" type="text" rows="10" cols="40" style="width: 70%">{{pageData['service'].abstract|nonone}}</textarea><br /><br />
                <span class="word">CORPO DELLA DESCRIZIONE</span><br />
                <textarea name="serviceBody" rows="30" cols="40" style="width: 70%">{{pageData['service'].body|nonone}}</textarea>
<!--                 <div class="row thin lineTop"><br /><br /> -->

                <div id="img_abb">
                <img src="/templates/service_img/{{pageData['service'].imagepath}}?{{pageData['now']}}" alt="{{pageData['service'].title}}" class="img_left" /><br /><br />
                <a HREF="/siteAdmin/fileupload?id={{pageData['service'].id}}&amp;part=serviceAdd"
                    onClick="return targetopener(this)">Aggiungi o modifica la foto abbinata</a></div>
            <br /><br />
                <input type="submit" class="wymupdate" value="Aggiungi/modifica"/></form>
        </div>

    {% elif req.path ==pageData['subdomain']+'/siteAdmin/serviceList' %}
        <div id="box">
                <span class="testa"><h1>Gestione SERVIZI</h1></span>
                <hr></hr>
                <div class="row normal">
                <a href="/siteAdmin/serviceAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi un servizio" title="aggiungi un servizio"/>
                </a>
                </div>
                {% for page in pageData['services'] %}
                <div class="row normal lineTop" >
                    <span >{{page.denomination}} {{page.insert_date|datetimeformat}}</span>
                    <span class="image normal"><a href="/siteAdmin/serviceDel?serviceId={{page.id}}" onClick='return confirm("Sei sicuro di voler cancellare questo modulo?")' ><img src="/templates/siteAdmin/img/trash.png" alt="elimina il servizio" title="elimina  il servizio"/></a></span>
                    <span class="image normal"><a href="/siteAdmin/serviceAdd?edit={{page.id}}"><img src="/templates/siteAdmin/img/modifica.png" alt="modifica un servizio" title="modifica un servizio"/></a></span>
            {% if page.active==1 %}
            <span class="image normal" >
                <a href="/siteAdmin/serviceActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_on.png" alt="disattiva servizio" title="disattiva servizio"/>
                </a>
            </span>
            {% endif%}
            {% if page.active==0 %}
            <span class="image normal">
                <a href="/siteAdmin/serviceActive?id={{page.id}}&amp;pag={{pageData['pag']+1}}">
                    <img src="/templates/siteAdmin/img/active_off.png" alt="attiva servizio" title="attiva servizio"/>
                </a>
            </span>
            {% endif%}
                    <span class="image normal">
                <a href="{{pageData['subdomain']}}/siteAdmin/servicePosition?id={{page.id}}&amp;pag={{pageData['pag']+1}}&amp;pos=giu">
                    <img src="/templates/siteAdmin/img/giu.png" alt="attiva modulo" title="attiva Modulo"/>
                </a>
            </span>

        <span class="image normal">
                <a href="{{pageData['subdomain']}}/siteAdmin/servicePosition?id={{page.id}}&amp;pag={{pageData['pag']+1}}&amp;pos=su">
                    <img src="/templates/siteAdmin/img/su.png" alt="attiva modulo" title="attiva Modulo"/>
                </a>
            </span>
                </div>
                {% endfor %}
            <ul class="pages">
                <li class="prima">Moduli</li>
                {% for i in range(0,pageData['item']) %}
                    {% if i != pageData['pag'] %}
                        <li><a href="/siteAdmin/serviceList?pag={{i+1}}">{{i+1}}</a></li>
                    {% else %}
                        <li>[<a href="/siteAdmin/serviceList?pag={{i+1}}">{{i+1}}</a>]</li>
                    {% endif %}
                {% endfor %}
            </ul>
                <div class="row normal lineTop">
                <a href="/siteAdmin/serviceAdd?new">
                    <img src="/templates/siteAdmin/img/add.png" alt="aggiungi una service" title="aggiungi una service"/>
                </a>
                </div>
        </div>

{% endif %}
<!--         </div> -->
{%endblock%}
